// 新建XMLHttpRequest对象

var resquest=new XMLHttpRequest();

resquest.open('get','https://api.openweathermap.org/data/2.5/forecast?q=Beijing,cn&appid=800f49846586c3ba6e7052cfc89af16c');

resquest.send();

console.log("已发送。。。。。。");


//ActiveXObject

function success(text){
    var textatrea=document.getElementById(test-ie-response-text);
    textatrea.value=text;
}



function fail(code){
    var textatrea=document.getElementById(test-ie-response-text);

    textatrea.value='Error code:'+code;
}
/*  */
//let ActiveXObject
//var resquest=new ActiveXObject('Microsoft.XMLHTTP');   // 新建Microsoft.XMLHTTP对象
/*
resquest.onreadystatechange=function(){
    if(resquest.readyState===4){
        //判断响应结果：
        if(resquest.status===200){
            //成功,通过responseText拿到响应的文本：
            return success(resquest.responseText)
        }else{
            // 失败，根据响应码判断 失败原因

            return fail(resquest.status);
            
        }
    }else{
        //HTTP请求还在继续...
    }

}

//发送请求:
resquest.open('get','https://api.openweathermap.org/data/2.5/forecast?q=Beijing,cn&appid=800f49846586c3ba6e7052cfc89af16c');
resquest .send();

console.log(resquest .send());
console.log("请求已发送！请接受");
console.log(resquest.open('get','https://api.openweathermap.org/data/2.5/forecast?q=Beijing,cn&appid=800f49846586c3ba6e7052cfc89af16c'));

*/
var request;
if (window.XMLHttpRequest) {
    request = new XMLHttpRequest();
} else {
    request = new ActiveXObject('Microsoft.XMLHTTP');
}